// Copyright 2010 The Go Example Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main

import (
	"archive/zip"
	"fmt"
	"io"
	"io/ioutil"
	"bytes"
)

func main() {

	z, err := zip.OpenReader("data/data.zip")
	if err != nil {
		return
	}

	fmt.Printf(z.Comment)

	// Print ZiP file count 
	l := len(z.File)
	fmt.Printf(" file count =  %d file .", l)

	// UnZip File  
	r, er := z.File[0].Open()
	if er != nil {
		return
	}
	defer r.Close()

	var b bytes.Buffer
	_, err2 := io.Copy(&b, r)
	if err2 != nil {
		return
	}

	ioutil.WriteFile("data/r.txt", b.Bytes(), 0444)

}
